<template>
    <el-form :model="form" ref="formData" :rules="rules" label-width="80px" :inline="false" size="normal">
        <el-row :gutter="24">
            <el-col :span="24">
                <el-form-item label="上级部门">
                    <el-select v-model="formData.parentId" placeholder="请选择">
                        <el-option label="一级部门" value="1"></el-option>
                    </el-select>
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="部门名称">
                    <el-input v-model="formData.name"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="负责人">
                    <el-input v-model="formData.leader"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="联系电话">
                    <el-input v-model="formData.phone"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="邮箱">
                    <el-input v-model="formData.email"></el-input>
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <!-- 状态 -->
                <el-form-item label="状态">
                    <el-radio-group v-model="formData.status">
                        <el-radio value="1">正常</el-radio>
                        <el-radio value="0">停用</el-radio>
                    </el-radio-group>
                </el-form-item>
            </el-col>
        </el-row>
        <el-form-item>
            <el-button type="primary" @click="onSubmit">立即创建</el-button>
            <el-button @click="close">取消</el-button>
        </el-form-item>
    </el-form>

</template>

<script setup>
import { ref, defineEmits } from 'vue'
import request from '@/api/request'
let emit = defineEmits(['ref-table'])
let formData = ref({
})
let onSubmit = () => {
    console.log(formData.value);
    request({
        method: "post",
        url: "/system/permission/department/insert",
        data: formData.value
    }).then(resp => {
        emit('ref-table')
    })
}
let close = () => {
    emit('ref-table')
}
</script>

<style scoped></style>
